<template>
  <div class="mt-4">
    <el-checkbox-group v-model="checkboxGroup1.items" size="small">
      <template v-for="i in list" :key="i">
        <el-checkbox :label="i" border />
      </template>
    </el-checkbox-group>
  </div>
  <el-button @click="checkAll" class="mt-4">checkAll or cancelAll</el-button>
</template>

<script lang="ts" setup name="测试Form">

let list = ref<string[]>(['夫', '俺', '樊'])
let checkboxGroup1 = reactive({
  items: []
})
const checkAll = () => {
  (checkboxGroup1.items as string[]) = checkboxGroup1.items.length === list.value.length ? [] : list.value
}
</script>
